{-# LINE 1 "E_Data.hsc" #-}
{-# LANGUAGE ForeignFunctionInterface #-}
{-# LINE 2 "E_Data.hsc" #-}
 
module E_Data where
 
import Foreign
import Foreign.Ptr
import Foreign.C.String
import Foreign.C.Types

       -- types.h needed for t_off

{-# LINE 12 "E_Data.hsc" #-}

{-# LINE 13 "E_Data.hsc" #-}

newtype E_Bool = E_Bool {unE_Bool :: CInt}
    deriving (Eq, Show)
e_true   :: E_Bool
e_true   = E_Bool 1
e_false  :: E_Bool
e_false  = E_Bool 0

{-# LINE 20 "E_Data.hsc" #-}

data Emem = Emem                        -- we never do anything with Emem in Haskell, so leave it opaque
instance Storable Emem where
    sizeOf    _ = ((40))
{-# LINE 24 "E_Data.hsc" #-}
    alignment _ = alignment (undefined :: CDouble)
    peek ptr = do
        return Emem
    poke ptr Emem = do
        return ()

type EmemRef = Ptr Emem
 
{-corresponds to -e_epiphany_t -}
data EpiphanyInfo = EpiphanyInfo { e_objtype :: CInt, e_type :: CInt, e_num_cores :: CInt, e_base_coreid :: CInt, e_row :: CInt, e_col :: CInt, e_rows :: CInt, e_cols :: CInt, e_core :: CInt, e_memfd :: CInt}
    deriving (Show)
type GroupRef = Ptr EpiphanyInfo

instance Storable EpiphanyInfo where
    sizeOf    _ = ((40))
{-# LINE 39 "E_Data.hsc" #-}
    alignment _ = alignment (undefined :: CDouble)
    peek ptr = do
        objtype         <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr    --object type identifier
{-# LINE 42 "E_Data.hsc" #-}
        tipe            <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr       -- Epiphany chip part number
{-# LINE 43 "E_Data.hsc" #-}
        num_cores       <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr  -- number of cores group
{-# LINE 44 "E_Data.hsc" #-}
        base_coreid     <- ((\hsc_ptr -> peekByteOff hsc_ptr 12)) ptr-- group base core ID
{-# LINE 45 "E_Data.hsc" #-}
        row             <- ((\hsc_ptr -> peekByteOff hsc_ptr 16)) ptr
{-# LINE 46 "E_Data.hsc" #-}
        col             <- ((\hsc_ptr -> peekByteOff hsc_ptr 20)) ptr
{-# LINE 47 "E_Data.hsc" #-}
        rows            <- ((\hsc_ptr -> peekByteOff hsc_ptr 24)) ptr
{-# LINE 48 "E_Data.hsc" #-}
        cols            <- ((\hsc_ptr -> peekByteOff hsc_ptr 28)) ptr
{-# LINE 49 "E_Data.hsc" #-}
        core            <- ((\hsc_ptr -> peekByteOff hsc_ptr 32)) ptr
{-# LINE 50 "E_Data.hsc" #-}
        memfd           <- ((\hsc_ptr -> peekByteOff hsc_ptr 36)) ptr
{-# LINE 51 "E_Data.hsc" #-}
        return  EpiphanyInfo { e_objtype=objtype, e_type=tipe, e_num_cores=num_cores, e_base_coreid=base_coreid, e_row=row, e_col=col, e_rows=rows, e_cols=cols, e_core=core, e_memfd=memfd }
 
    poke ptr (EpiphanyInfo e_objtype e_type e_num_cores e_base_coreid e_row e_col e_rows e_cols e_core e_memfd) = do
        ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr e_objtype
{-# LINE 55 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr e_type
{-# LINE 56 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr e_num_cores
{-# LINE 57 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 12)) ptr e_base_coreid
{-# LINE 58 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 16)) ptr e_row
{-# LINE 59 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 20)) ptr e_col
{-# LINE 60 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 24)) ptr e_rows
{-# LINE 61 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 28)) ptr e_cols
{-# LINE 62 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 32)) ptr e_core
{-# LINE 63 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 36)) ptr e_memfd
{-# LINE 64 "E_Data.hsc" #-}
 
{-corresponds to -e_platform_t -}
data PlatformInfo = PlatformInfo { p_objtype::CInt, p_type::CInt, p_version::CInt, p_hal_ver::CInt, p_initialized::CInt, p_regs_base::CInt, p_num_chips::CInt, p_chip::CInt, p_row::CInt, p_col::CInt, p_rows::CInt, p_cols::CInt, p_num_emems::CInt, p_emem::CInt}
    deriving (Show)
 
instance Storable PlatformInfo where
    sizeOf    _ = ((84))
{-# LINE 71 "E_Data.hsc" #-}
    alignment _ = alignment (undefined :: CDouble)
    peek ptr = do
        objtype         <- ((\hsc_ptr -> peekByteOff hsc_ptr 0)) ptr    -- object type identifier
{-# LINE 74 "E_Data.hsc" #-}
        tipe            <- ((\hsc_ptr -> peekByteOff hsc_ptr 4)) ptr       -- platform part number
{-# LINE 75 "E_Data.hsc" #-}
        version         <- ((\hsc_ptr -> peekByteOff hsc_ptr 8)) ptr    -- version number of platform
{-# LINE 76 "E_Data.hsc" #-}
        hal_ver         <- ((\hsc_ptr -> peekByteOff hsc_ptr 40)) ptr    -- version number of the E-HAL
{-# LINE 77 "E_Data.hsc" #-}
        initialized     <- ((\hsc_ptr -> peekByteOff hsc_ptr 44)) ptr-- platform initialized?
{-# LINE 78 "E_Data.hsc" #-}
        regs_base       <- ((\hsc_ptr -> peekByteOff hsc_ptr 48)) ptr  -- base address of platform registers
{-# LINE 79 "E_Data.hsc" #-}
        num_chips       <- ((\hsc_ptr -> peekByteOff hsc_ptr 52)) ptr  -- number of Epiphany chips in platform
{-# LINE 80 "E_Data.hsc" #-}
        chip            <- ((\hsc_ptr -> peekByteOff hsc_ptr 56)) ptr       -- pointer to array of Epiphany chip objects
{-# LINE 81 "E_Data.hsc" #-}
        row             <- ((\hsc_ptr -> peekByteOff hsc_ptr 60)) ptr
{-# LINE 82 "E_Data.hsc" #-}
        col             <- ((\hsc_ptr -> peekByteOff hsc_ptr 64)) ptr
{-# LINE 83 "E_Data.hsc" #-}
        rows            <- ((\hsc_ptr -> peekByteOff hsc_ptr 68)) ptr
{-# LINE 84 "E_Data.hsc" #-}
        cols            <- ((\hsc_ptr -> peekByteOff hsc_ptr 72)) ptr
{-# LINE 85 "E_Data.hsc" #-}
        num_emems       <- ((\hsc_ptr -> peekByteOff hsc_ptr 76)) ptr  --
{-# LINE 86 "E_Data.hsc" #-}
        emem            <- ((\hsc_ptr -> peekByteOff hsc_ptr 80)) ptr       --
{-# LINE 87 "E_Data.hsc" #-}
        return  PlatformInfo {
            p_objtype=objtype,
            p_type=tipe,
            p_version=version,
            p_hal_ver=hal_ver,
            p_initialized=initialized,
            p_regs_base=regs_base,
            p_num_chips=num_chips,
            p_chip=chip,
            p_row=row,
            p_col=col,
            p_rows=rows,
            p_cols=cols,
            p_num_emems=num_emems,
            p_emem=emem }
    poke ptr (PlatformInfo p_objtype p_type p_version p_hal_ver p_initialized p_regs_base p_num_chips p_chip p_row p_col p_rows p_cols p_num_emems p_emem) = do
        ((\hsc_ptr -> pokeByteOff hsc_ptr 0)) ptr p_objtype        -- object type identifier
{-# LINE 104 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 4)) ptr p_type              -- platform part number
{-# LINE 105 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 8)) ptr p_version        -- version number of platform
{-# LINE 106 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 40)) ptr p_hal_ver        -- version number of the E-HAL
{-# LINE 107 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 44)) ptr p_initialized-- platform initialized?
{-# LINE 108 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 48)) ptr p_regs_base    -- base address of platform registers
{-# LINE 109 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 52)) ptr p_num_chips    -- number of Epiphany chips in platform
{-# LINE 110 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 56)) ptr p_chip              -- array of Epiphany chip objects
{-# LINE 111 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 60)) ptr p_row                -- platform absolute minimum row number
{-# LINE 112 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 64)) ptr p_col                -- platform absolute minimum col number
{-# LINE 113 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 68)) ptr p_rows              -- number of rows in platform
{-# LINE 114 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 72)) ptr p_cols              -- number of cols in platform
{-# LINE 115 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 76)) ptr p_num_emems    -- number of external memory segments in platform
{-# LINE 116 "E_Data.hsc" #-}
        ((\hsc_ptr -> pokeByteOff hsc_ptr 80)) ptr p_emem              -- array of external memory segments
{-# LINE 117 "E_Data.hsc" #-}
 
 

